<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

<input max=100 type="range" id="slider">

<script>
document.getElementById("slider").addEventListener("input", function() {
  this.removeAttribute("type");
});
var centerY = slider.offsetTop + slider.offsetHeight / 2;
var centerX = slider.offsetLeft + slider.offsetWidth / 2;
var rightEdgeX = slider.offsetLeft + slider.offsetWidth - 1;
const touchIdentifier = 1;

function smoothDrag() {
  return new Promise((resolve, reject) => {
    chrome.gpuBenchmarking.smoothDrag(centerX, centerY, rightEdgeX, centerY,
      resolve, touchIdentifier);
  })
}

const IS_MAC = navigator.platform.indexOf('Mac') == 0;
promise_test(t => {
  if (!IS_MAC) {
    return smoothDrag();
  } else {
    return new Promise((resolve, reject) => {
      resolve();
    });
  }
}, 'Drag on removed slider should not crash.');

</script>